import request from "@/utils/request";

export interface loginParams {
  adminname: string;
  password: string;
}

/**
 * 登录
 * @param data
 */
export function login(data: loginParams) {
  return request({
    url: "/admin/admin/login",
    method: "POST",
    data,
  });
}

/**
 * 获取管理员列表
 */
export function getAdminList() {
  return request({
    url: "/admin/admin/list",
    method: "GET",
  });
}

/**
 * 获取管理员列表
 */
export function addAdmin(data: any) {
  return request({
    url: "/admin/admin/add",
    method: "POST",
    data,
  });
}

/**
 * 修改管理员
 */
export function editAdmin(data: any) {
  return request({
    url: "/admin/admin/update",
    method: "POST",
    data,
  });
}

/**
 * 删除管理员
 */
export function delAdmin(adminId: string) {
  return request({
    url: "/admin/admin/delete",
    method: "POST",
    data: {
      adminid: adminId,
    },
  });
}
